package cn.how2go.common.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/7/15.
 */
public class Warnning implements Serializable{
    /**
     * 紧急报警
     */
    private boolean warn00;
    /**
     * 超速报警
     */
    private boolean warn01;
    /**
     * 疲劳驾驶
     */
    private boolean warn02;
    /**
     * 预警
     */
    private boolean warn03;
    /**
     * GNSS模块发生故障
     */
    private boolean warn04;
    /**
     * GNSS天线未接或被剪断
     */
    private boolean warn05;
    /**
     * GNSS天线短路
     */
    private boolean warn06;
    /**
     * 终端主电源欠压
     */
    private boolean warn07;
    /**
     * 终端主电源掉电
     */
    private boolean warn08;
    /**
     * 终端LCD或显示器故障
     */
    private boolean warn09;
    /**
     * TTS模块故障
     */
    private boolean warn10;
    /**
     * 摄像头故障
     */
    private boolean warn11;
    /**
     * 累计驾驶超时
     */
    private boolean warn18;
    /**
     * 超时停车
     */
    private boolean warn19;
    /**
     * 进出区域
     */
    private boolean warn20;
    /**
     * 进出路线
     */
    private boolean warn21;
    /**
     * 路段行驶时间不足/过长
     */
    private boolean warn22;
    /**
     * 路线偏离报警
     */
    private boolean warn23;
    /**
     * 车辆VSS故障
     */
    private boolean warn24;
    /**
     * 车辆油量异常
     */
    private boolean warn25;
    /**
     * 车辆被盗
     */
    private boolean warn26;
    /**
     * 车辆非法熄火
     */
    private boolean warn27;
    /**
     * 车辆非法位移
     */
    private boolean warn28;
    /**
     * 碰撞侧翻报警
     */
    private boolean warn29;

    public Warnning(int warnning) {
        this.warn00 = (warnning & 0x00000001) == 0x00000001;
        this.warn01 = (warnning & 0x00000002) == 0x00000002;
        this.warn02 = (warnning & 0x00000004) == 0x00000004;
        this.warn03 = (warnning & 0x00000008) == 0x00000008;
        this.warn04 = (warnning & 0x00000010) == 0x00000010;
        this.warn05 = (warnning & 0x00000020) == 0x00000020;
        this.warn06 = (warnning & 0x00000040) == 0x00000040;
        this.warn07 = (warnning & 0x00000080) == 0x00000080;
        this.warn08 = (warnning & 0x00000100) == 0x00000100;
        this.warn09 = (warnning & 0x00000200) == 0x00000200;
        this.warn10 = (warnning & 0x00000400) == 0x00000400;
        this.warn11 = (warnning & 0x00000800) == 0x00000800;
        this.warn18 = (warnning & 0x00040000) == 0x00040000;
        this.warn19 = (warnning & 0x00080000) == 0x00080000;
        this.warn20 = (warnning & 0x00100000) == 0x00100000;
        this.warn21 = (warnning & 0x00200000) == 0x00200000;
        this.warn22 = (warnning & 0x00400000) == 0x00400000;
        this.warn23 = (warnning & 0x00800000) == 0x00800000;
        this.warn24 = (warnning & 0x01000000) == 0x01000000;
        this.warn25 = (warnning & 0x02000000) == 0x02000000;
        this.warn26 = (warnning & 0x04000000) == 0x04000000;
        this.warn27 = (warnning & 0x08000000) == 0x08000000;
        this.warn28 = (warnning & 0x10000000) == 0x10000000;
        this.warn29 = (warnning & 0x20000000) == 0x20000000;
    }

    public boolean isWarn00() {
        return warn00;
    }

    public void setWarn00(boolean warn00) {
        this.warn00 = warn00;
    }

    public boolean isWarn01() {
        return warn01;
    }

    public void setWarn01(boolean warn01) {
        this.warn01 = warn01;
    }

    public boolean isWarn02() {
        return warn02;
    }

    public void setWarn02(boolean warn02) {
        this.warn02 = warn02;
    }

    public boolean isWarn03() {
        return warn03;
    }

    public void setWarn03(boolean warn03) {
        this.warn03 = warn03;
    }

    public boolean isWarn04() {
        return warn04;
    }

    public void setWarn04(boolean warn04) {
        this.warn04 = warn04;
    }

    public boolean isWarn05() {
        return warn05;
    }

    public void setWarn05(boolean warn05) {
        this.warn05 = warn05;
    }

    public boolean isWarn06() {
        return warn06;
    }

    public void setWarn06(boolean warn06) {
        this.warn06 = warn06;
    }

    public boolean isWarn07() {
        return warn07;
    }

    public void setWarn07(boolean warn07) {
        this.warn07 = warn07;
    }

    public boolean isWarn08() {
        return warn08;
    }

    public void setWarn08(boolean warn08) {
        this.warn08 = warn08;
    }

    public boolean isWarn09() {
        return warn09;
    }

    public void setWarn09(boolean warn09) {
        this.warn09 = warn09;
    }

    public boolean isWarn10() {
        return warn10;
    }

    public void setWarn10(boolean warn10) {
        this.warn10 = warn10;
    }

    public boolean isWarn11() {
        return warn11;
    }

    public void setWarn11(boolean warn11) {
        this.warn11 = warn11;
    }

    public boolean isWarn18() {
        return warn18;
    }

    public void setWarn18(boolean warn18) {
        this.warn18 = warn18;
    }

    public boolean isWarn19() {
        return warn19;
    }

    public void setWarn19(boolean warn19) {
        this.warn19 = warn19;
    }

    public boolean isWarn20() {
        return warn20;
    }

    public void setWarn20(boolean warn20) {
        this.warn20 = warn20;
    }

    public boolean isWarn21() {
        return warn21;
    }

    public void setWarn21(boolean warn21) {
        this.warn21 = warn21;
    }

    public boolean isWarn22() {
        return warn22;
    }

    public void setWarn22(boolean warn22) {
        this.warn22 = warn22;
    }

    public boolean isWarn23() {
        return warn23;
    }

    public void setWarn23(boolean warn23) {
        this.warn23 = warn23;
    }

    public boolean isWarn24() {
        return warn24;
    }

    public void setWarn24(boolean warn24) {
        this.warn24 = warn24;
    }

    public boolean isWarn25() {
        return warn25;
    }

    public void setWarn25(boolean warn25) {
        this.warn25 = warn25;
    }

    public boolean isWarn26() {
        return warn26;
    }

    public void setWarn26(boolean warn26) {
        this.warn26 = warn26;
    }

    public boolean isWarn27() {
        return warn27;
    }

    public void setWarn27(boolean warn27) {
        this.warn27 = warn27;
    }

    public boolean isWarn28() {
        return warn28;
    }

    public void setWarn28(boolean warn28) {
        this.warn28 = warn28;
    }

    public boolean isWarn29() {
        return warn29;
    }

    public void setWarn29(boolean warn29) {
        this.warn29 = warn29;
    }

    @Override
    public String toString() {
        String warnning = "Warnning{" ;
        if(warn00) { warnning += "紧急报警,"; }
        if(warn01) { warnning += "超速报警,"; }
        if(warn02) { warnning += "疲劳驾驶,"; }
        if(warn03) { warnning += "预警,"; }
        if(warn04) { warnning += "GNSS模块发生故障,"; }
        if(warn05) { warnning += "GNSS天线未接或被剪断,"; }
        if(warn06) { warnning += "GNSS天线短路,"; }
        if(warn07) { warnning += "终端主电源欠压,"; }
        if(warn08) { warnning += "终端主电源掉电,"; }
        if(warn09) { warnning += "终端LCD或显示器故障,"; }

        if(warn10) { warnning += "TTS模块故障,"; }
        if(warn11) { warnning += "摄像头故障,"; }
        if(warn18) { warnning += "累计驾驶超时,"; }
        if(warn19) { warnning += "超时停车,"; }

        if(warn20) { warnning += "进出区域,"; }
        if(warn21) { warnning += "进出路线,"; }
        if(warn22) { warnning += "路段行驶时间不足/过长,"; }
        if(warn23) { warnning += "路线偏离报警,"; }
        if(warn24) { warnning += "车辆VSS故障,"; }
        if(warn25) { warnning += "车辆油量异常,"; }
        if(warn26) { warnning += "车辆被盗,"; }
        if(warn27) { warnning += "车辆非法熄火,"; }
        if(warn28) { warnning += "车辆非法位移,"; }
        if(warn29) { warnning += "碰撞侧翻报警,"; }
        warnning += '}';
        return  warnning;
    }

    public List<String> toList(){
        List<String> list = new ArrayList<>();
        if(warn00) { list.add("紧急报警,"); }
        if(warn01) { list.add("超速报警,"); }
        if(warn02) { list.add("疲劳驾驶,"); }
        if(warn03) { list.add("预警,"); }
        if(warn04) { list.add("GNSS模块发生故障,"); }
        if(warn05) { list.add("GNSS天线未接或被剪断,"); }
        if(warn06) { list.add("GNSS天线短路,"); }
        if(warn07) { list.add("终端主电源欠压,"); }
        if(warn08) { list.add("终端主电源掉电,"); }
        if(warn09) { list.add("终端LCD或显示器故障,"); }

        if(warn10) { list.add("TTS模块故障,"); }
        if(warn11) { list.add("摄像头故障,"); }
        if(warn18) { list.add("累计驾驶超时,"); }
        if(warn19) { list.add("超时停车,"); }

        if(warn20) { list.add("进出区域,"); }
        if(warn21) { list.add("进出路线,"); }
        if(warn22) { list.add("路段行驶时间不足/过长,"); }
        if(warn23) { list.add("路线偏离报警,"); }
        if(warn24) { list.add("车辆VSS故障,"); }
        if(warn25) { list.add("车辆油量异常,"); }
        if(warn26) { list.add("车辆被盗,"); }
        if(warn27) { list.add("车辆非法熄火,"); }
        if(warn28) { list.add("车辆非法位移,"); }
        if(warn29) { list.add("碰撞侧翻报警,"); }
        return list;
    }
}
